博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
wpgcms---详情页面数据怎么渲染
阅读量:6880 次
发布时间:2019-06-27

本文共 2055 字,大约阅读时间需要 6 分钟。

wpgcms的详情页面的数据会被保存在 contentInfo 这么一个字段里面。

面包屑导航调用:

当前位置 {

% for c in crumb|slice(1, crumb|length-1) %} {
% if not loop.last %}> {
{ c.name }}
{
% else %}> 新闻详情 {
% endif %}{
% endfor %}

标题,正文,时间的调用:

{
{ contentInfo.title }}

{% autoescape false %} {
{ contentInfo.getBodyInfo() }} {% endautoescape %}
{% set pubtime = contentInfo.publish_time %} 时间:{
{ pubtime|slice(0, 4) }}年{
{ pubtime|slice(5, 2) }}月{
{ pubtime|slice(8, 2) }}日
来源:{
{ contentInfo.source_name|default('金塔集团') }}
阅读:{
{ contentInfo.view_count }}

下一篇,下一篇的调用:

{% set nextInfo = contentInfo.nextInfo %} {% if nextInfo %} 下一篇:{

{ nextInfo.title }} {% endif %}

完整实例:

{% extends 'layout.html' %}{% block pageContent %}

当前位置 {% for c in crumb|slice(1, crumb|length-1) %} {% if not loop.last %}> {

{ c.name }} {% else %}> 新闻详情 {% endif %} {% endfor %}

{
{ contentInfo.title }}

{% autoescape false %} {
{ contentInfo.getBodyInfo() }} {% endautoescape %}
{% set pubtime = contentInfo.publish_time %} 时间:{ { pubtime|slice(0, 4) }}年{ { pubtime|slice(5, 2) }}月{ { pubtime|slice(8, 2) }}日 来源:{ { contentInfo.source_name|default('金塔集团') }} 阅读:{ { contentInfo.view_count }}

{% set nextInfo = contentInfo.nextInfo %} {% if nextInfo %} 下一篇:{

{ nextInfo.title }} {% endif %}

{% endblock %}

 

转载于:https://www.cnblogs.com/e0yu/p/9928409.html

你可能感兴趣的文章
CF437D(The Child and Zoo)最小生成树
查看>>
8VC Venture Cup 2016 - Elimination Round D. Jerry's Protest 暴力
查看>>
数据仓库工具:Hive
查看>>
Swift - IBOutlet返回nil(fatal error: unexpectedly found nil while unwrapping an Optional value)
查看>>
Failed to upgrade Oracle Cluster Registry configuration(root.sh)
查看>>
RequestDispatcher 的 forward和include
查看>>
MySQL常用操作总结
查看>>
Sublime text3 插件HTML/CSS/JS prettify 格式化代码
查看>>
CodePen's CSS
查看>>
查找jar包的站点
查看>>
LeetCode - 37. Sudoku Solver
查看>>
C# 自己定义 implicit和explicit转换
查看>>
zabbix监控nginx连接状态(转)
查看>>
嵌入式 hi3518x平台h264+g711a封装mp4代码demo
查看>>
三元运算符
查看>>
iOS界面调试工具 Reveal-备用
查看>>
对聚集表查询的时候,未显式指定排序列的时候,默认查询结果的顺序一定是按照聚集索引顺序排序的吗...
查看>>
elasticsearch 八、重要的配置更改
查看>>
关于如何显示Jianshu图片的方案
查看>>
05_打字游戏
查看>>